package com.itheima.listener;

import com.itheima.domain.mongo.MovementScore;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author 请不要叫我高司令
 * @Date 2022/3/27 17:27
 * @Version 1.0
 */

@Component
public class MovementScoreListener {

    @Autowired
    private MongoTemplate mongoTemplate;

    @RabbitListener(queuesToDeclare = @Queue("tanhua.recommend.movement"))
    public void listenMovementScore(MovementScore movementScore) {

        System.out.println("接收动态评分日志：" + movementScore);
        mongoTemplate.save(movementScore);

    }


}
